%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/interfaces-single-table/basics-with-fragments"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 6, 8, 9, 10<br />2: PgSelectInlineApply[76]<br />3: PgSelect[7]<br />ᐳ: Access[77]<br />4: PgSelectRows[11]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 77<br /><br />ROOT __Item{1}ᐸ11ᐳ[12]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 13, 77, 12<br /><br />ROOT PgSelectSingle{1}ᐸpeopleᐳ[13]<br />1: <br />ᐳ: 14, 78, 79<br />2: PgSelectRows[20]"):::bucket
    Bucket3("Bucket 3 (listItem)<br /><br />ROOT __Item{3}ᐸ20ᐳ[21]"):::bucket
    Bucket4("Bucket 4 (polymorphic)<br />__typename: Lambda[26]<br />Deps: 22, 26, 23, 25, 37, 42, 47, 52, 57, 62"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸpeopleᐳ<br />More deps:<br />- Constantᐸundefinedᐳ[6]"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgSelectInlineApply76["PgSelectInlineApply[76∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[6]<br />- Constantᐸundefinedᐳ[6]"]:::plan
    Object10 & PgSelectInlineApply76 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    PgSelectRows11[["PgSelectRows[11∈0] ➊"]]:::plan
    PgSelect7 --> PgSelectRows11
    Access77{{"Access[77∈0] ➊<br />ᐸ7.m.subqueryDetailsFor16ᐳ"}}:::plan
    PgSelect7 --> Access77
    __Item12[/"__Item[12∈1]<br />ᐸ11ᐳ"\]:::itemplan
    PgSelectRows11 ==> __Item12
    PgSelectSingle13{{"PgSelectSingle[13∈1]<br />ᐸpeopleᐳ"}}:::plan
    __Item12 --> PgSelectSingle13
    List78{{"List[78∈2]<br />ᐸ77,12ᐳ"}}:::plan
    Access77 & __Item12 --> List78
    PgClassExpression14{{"PgClassExpression[14∈2]<br />ᐸ__people__.”username”ᐳ"}}:::plan
    PgSelectSingle13 --> PgClassExpression14
    PgSelectRows20[["PgSelectRows[20∈2]"]]:::plan
    Lambda79{{"Lambda[79∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda79 --> PgSelectRows20
    List78 --> Lambda79
    __Item21[/"__Item[21∈3]<br />ᐸ20ᐳ"\]:::itemplan
    PgSelectRows20 ==> __Item21
    PgSelectSingle22{{"PgSelectSingle[22∈3]<br />ᐸsingle_table_itemsᐳ"}}:::plan
    __Item21 --> PgSelectSingle22
    PgClassExpression23{{"PgClassExpression[23∈3]<br />ᐸ__single_t...ems__.”id”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression23
    PgClassExpression25{{"PgClassExpression[25∈3]<br />ᐸ__single_t...s__.”type”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression25
    Lambda26{{"Lambda[26∈3]"}}:::plan
    PgClassExpression25 --> Lambda26
    PgClassExpression37{{"PgClassExpression[37∈3]<br />ᐸ__single_t...__.”type2”ᐳ"}}:::plan
    PgClassExpression23 o--o PgClassExpression37
    PgClassExpression42{{"PgClassExpression[42∈3]<br />ᐸ__single_t...”position”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression42
    PgClassExpression47{{"PgClassExpression[47∈3]<br />ᐸ__single_t...reated_at”ᐳ"}}:::plan
    PgClassExpression42 o--o PgClassExpression47
    PgClassExpression52{{"PgClassExpression[52∈3]<br />ᐸ__single_t...pdated_at”ᐳ"}}:::plan
    PgClassExpression47 o--o PgClassExpression52
    PgClassExpression57{{"PgClassExpression[57∈3]<br />ᐸ__single_t..._archived”ᐳ"}}:::plan
    PgClassExpression52 o--o PgClassExpression57
    PgClassExpression62{{"PgClassExpression[62∈3]<br />ᐸ__single_t...chived_at”ᐳ"}}:::plan
    PgClassExpression57 o--o PgClassExpression62
    PgClassExpression67{{"PgClassExpression[67∈4]<br />ᐸ__single_t...__.”title”ᐳ<br />ᐳSingleTableTopic<br />ᐳSingleTablePost<br />ᐳSingleTableDivider<br />ᐳSingleTableChecklist"}}:::plan
    PgClassExpression62 o--o PgClassExpression67
    PgClassExpression71{{"PgClassExpression[71∈4]<br />ᐸ__single_t...scription”ᐳ<br />ᐳSingleTableChecklistItem<br />ᐳSingleTablePost"}}:::plan
    PgClassExpression67 o--o PgClassExpression71
    PgClassExpression73{{"PgClassExpression[73∈4]<br />ᐸ__single_t...__.”color”ᐳ<br />ᐳSingleTableDivider"}}:::plan
    PgClassExpression71 o--o PgClassExpression73
    PgClassExpression74{{"PgClassExpression[74∈4]<br />ᐸ__single_t...s__.”note”ᐳ<br />ᐳSingleTableChecklistItem<br />ᐳSingleTablePost"}}:::plan
    PgClassExpression73 o--o PgClassExpression74

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,PgSelectRows11,PgSelectInlineApply76,Access77 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item12,PgSelectSingle13 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression14,PgSelectRows20,List78,Lambda79 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item21,PgSelectSingle22,PgClassExpression23,PgClassExpression25,Lambda26,PgClassExpression37,PgClassExpression42,PgClassExpression47,PgClassExpression52,PgClassExpression57,PgClassExpression62 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression67,PgClassExpression71,PgClassExpression73,PgClassExpression74 bucket4

